import { BaseDomain } from '@/common/domain/BaseDomain';
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { IsNotEmpty, IsNumber, IsString, IsOptional } from 'class-validator';
import { queryDomain } from '@/common/domain/queryDomain';
/**@description 查询租赁关系表Dto */
export class QueryRentalLeaseDto extends queryDomain {
  @ApiProperty({ description: '租客ID', required: false })
  @IsOptional()
  @Transform((v) => +v.value)
  @IsNumber()
  tenantId: number | null;
  @ApiProperty({
    description: '租赁状态（0-已结束，1-进行中）',
    required: false,
  })
  @IsOptional()
  leaseStatus: string | null;
}
/**@description 创建租赁关系表Dto */
export class CreateRentalLeaseDto {
  @ApiProperty({ description: '租客ID', required: true })
  @IsNotEmpty({ message: '租客ID不能为空' })
  @Transform((v) => +v.value)
  @IsNumber()
  tenantId: number;
  @ApiProperty({ description: '房源ID', required: true })
  @IsNotEmpty({ message: '房源ID不能为空' })
  @Transform((v) => +v.value)
  @IsNumber()
  houseId: number;
  @ApiProperty({
    description: '租赁状态（0-已结束，1-进行中）',
    required: true,
  })
  @IsNotEmpty({ message: '租赁状态（0-已结束，1-进行中）不能为空' })
  @IsString()
  leaseStatus: string;
  @ApiProperty({ description: '删除标记（0-已删除，1-正常）', required: true })
  @IsNotEmpty({ message: '删除标记（0-已删除，1-正常）不能为空' })
  @IsString()
  delFlag: string;
  @ApiProperty({ description: '创建时间', required: false })
  @IsOptional()
  @IsString()
  createTime?: string;
  @ApiProperty({ description: '更新时间', required: false })
  @IsOptional()
  @IsString()
  updateTime: string;
  @ApiProperty({ description: '开始日期', required: false })
  @IsNotEmpty({ message: '开始日期不能为空' })
  @IsString()
  startDate: string;
  @ApiProperty({ description: '结束日期', required: false })
  @IsNotEmpty({ message: '开始日期不能为空' })
  @IsString()
  endDate: string;
}
/**@description 更新租赁关系表Dto */
export class UpdateRentalLeaseDto {
  @ApiProperty({ description: '租赁ID' })
  @IsNotEmpty({ message: '租赁ID不能为空' })
  @Transform((v) => +v.value)
  @IsNumber()
  id: number;
  @ApiProperty({ description: '租客ID', required: true })
  @IsNotEmpty({ message: '租客ID不能为空' })
  @Transform((v) => +v.value)
  @IsNumber()
  tenantId: number;
  @ApiProperty({ description: '房源ID', required: true })
  @IsNotEmpty({ message: '房源ID不能为空' })
  @Transform((v) => +v.value)
  @IsNumber()
  houseId: number;
  @ApiProperty({
    description: '租赁状态（0-已结束，1-进行中）',
    required: true,
  })
  @IsNotEmpty({ message: '租赁状态（0-已结束，1-进行中）不能为空' })
  @IsString()
  leaseStatus: string;
  @ApiProperty({ description: '删除标记（0-已删除，1-正常）', required: true })
  @IsNotEmpty({ message: '删除标记（0-已删除，1-正常）不能为空' })
  @IsString()
  delFlag: string;
  @ApiProperty({ description: '更新时间', required: false })
  @IsOptional()
  @IsString()
  updateTime?: string;
  @ApiProperty({ description: '开始日期', required: false })
  @IsOptional()
  @IsString()
  startDate?: string;
  @ApiProperty({ description: '结束日期', required: false })
  @IsOptional()
  @IsString()
  endDate?: string;
}
